#include <cstdlib> // defines std::size_t
#include <iterator> // defines std::iterator_traits

typedef std::size_t arity;

template <arity d, typename position, typename ordering>
class heap_policy {

};

template <typename position, typename ordering>
class heap_policy <2, position, ordering> {
public: 
  typedef typename std::iterator_traits<position>::difference_type index;
  typedef typename std::iterator_traits<position>::difference_type level;
  typedef typename std::iterator_traits<position>::value_type element;

  heap_policy(index n = 0);

  index size() const;
  level depth(index) const;
  index last_leaf() const;
  index first_child(index) const;
  index last_child(index) const;
  index parent(index) const;
  index top_some_absent(position, index, const ordering&) const;
  index top_all_present(position, index, const ordering&) const;
  void update_some_absent(position, index, const element&, 
    const ordering&);
  void update_all_present(position, index, const element&, 
    const ordering&);
  void visit_branch_first_time(position, index, const ordering&);
  void erase_last_leaf(position);
private:
  index n;
};
